<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use App\Providers\MyUserProvider;

trait UserTrait
{
    use Authenticatable, Authorizable;

    public function getUserType()
    {
        return MyUserProvider::USER_TYPE_USER;
    }

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getUserType() . ':' . $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [
            'id',
            'username',
            'level_id'
        ];
    }
}
